package com.hrg.rds.biz.waybill.service.impl;

import com.hrg.rds.biz.waybill.domain.instance.CmdInstance;
import com.hrg.rds.biz.waybill.domain.instance.CmdInstanceDto;
import com.hrg.rds.biz.waybill.mapper.CmdInstanceMapper;
import com.hrg.rds.biz.waybill.service.CmdInstanceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Slf4j
@Service
public class CmdInstanceServiceImpl implements CmdInstanceService {

    @Autowired
    private CmdInstanceMapper cmdInstanceMapper;

    @Override
    public List<CmdInstance> selectList(CmdInstanceDto cmdInstanceDto) {
        return cmdInstanceMapper.selectList(cmdInstanceDto);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void insert(CmdInstance cmdInstance) {
        cmdInstanceMapper.insert(cmdInstance);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void insertBatch(List<CmdInstance> list) {
        cmdInstanceMapper.insertBatch(list);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void updateById(CmdInstance cmdInstance) {
        cmdInstanceMapper.updateById(cmdInstance);
    }
}
